package com.qc31.monitorlib.ui.carsmonitor

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import autodispose2.autoDispose
import com.qc31.baselib.auto.AutoDisposeViewModel
import com.qc31.comlib.entity.CarAround
import com.qc31.comlib.net.ServiceHelper

/** @Author pc_hfjs @Date 2022/3/10 9:28 @Desc */
class CarsAroundViewModel : AutoDisposeViewModel() {
    var carId: String = ""
    private val _aroundLive = MutableLiveData<MutableList<CarAround>>()
    val aroundLive: LiveData<MutableList<CarAround>> = _aroundLive
    fun getCarAround(radius: String) {
        ServiceHelper.getRepository().getCarAround(carId, radius).autoDispose(this)
            .subscribe({
                _aroundLive.postValue(it)
            }, error)
    }
}